<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  <body>
		<div class="widget-box">
       <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span>
         <h5>调查问卷</h5>
       </div>
       <div class="widget-content nopadding">
         <form action="/wjgl/yzgl/addFactor.html" method="post" class="form-horizontal" id="surveyForm">
           <div class="control-group">
             <label class="control-label"><span style="color:red;">*</span>问卷名称</label>
             <div class="controls">
                <s:textfield name="name" cssClass="span3" id="name" maxlength="40" cssStyle="width:300px;"></s:textfield>
             </div>
           </div>
           <div class="control-group">
             <label class="control-label">卷首语</label>
             <div class="controls">
               <s:textarea name="preface" id="preface" cssStyle="margin:0px; width:99%; height:85px;"></s:textarea>
             </div>
           </div>
            <div class="control-group">
             <label class="control-label">卷尾语</label>
             <div class="controls">
               <s:textarea name="afterword" id="afterword" cssStyle="margin:0px; width:99%; height:85px;"></s:textarea>
             </div>
           </div>
            <div class="control-group">
             <label class="control-label">是否启用</label>
             <div class="controls">
              	<s:radio name="usedFlg" list="#{'0':'启用','1':'不启用'}" theme="simple" value="0"></s:radio>
             </div>
           </div>
           <div class="modal-footer">
           	<div style="float:left;">"<span style="color:red;">*</span>"为必填项。</div>
           	<a href="#" class="btn" data-dismiss="modal" onclick="closeDialog();" >关闭</a>
           	<a href="#" id="add-event-submit" class="btn btn-primary" onclick="saveSurvey();" >保存</a>
           </div>
         </form>
       </div>
     </div>
  </body>
  	<link rel="stylesheet" href="<%=request.getContextPath() %>/css/bootstrap.min.css" />
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/matrix-style.css" />
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/matrix-media.css" />
  	<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.min.js"></script> 
  	<script type="text/javascript" src="<%=request.getContextPath() %>/js/lhgdialog/dialogUtilNew.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/lhgdialog/lhgdialog.min.js?skin=iblue"></script>
		<link rel="stylesheet" href="<%=request.getContextPath() %>/js/validate/css/validate.css" type="text/css" media="all" />
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate/talent-validate-all-min.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery/plugin/jquery.form.min.js"></script>
		
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/editor/kindeditor-min.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/editor/editorParams.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/editor/zh_CN.js"></script>
		<link href="<%=request.getContextPath() %>/font-awesome/css/font-awesome.css" rel="stylesheet" />	
		<script type="text/javascript">
			var prefaceEditor,afterwordEditor;
		
			function saveSurvey(){
				if (zfValidate.validate() ){
					jQuery(".btn").attr("disabled", "disabled");
					jQuery("#preface").val(prefaceEditor.html());
					jQuery("#afterword").val(afterwordEditor.html());
					
					jQuery("#surveyForm").ajaxSubmit({
						url:"<%=request.getContextPath() %>/wjgl/survey/addSurvey.html",
						type:"post",
						dataType:"json",
						success:function(data){
							alertSuccess(data,refershParent());
						}
					});
				}
			}
			
			jQuery(function(){
				zfValidate.vf.req.add('name');
				prefaceEditor = KindEditor.create('textarea[name="preface"]', simpleOption);
				afterwordEditor = KindEditor.create('textarea[name="afterword"]', simpleOption);
			});


		</script>
</html>
